﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace ElingOA6_DSJCJ.BLL
{
    /// <summary>
    /// 通用方法
    /// </summary>
    public  class Common
    {
        /// <summary>
        /// 创建DAL
        /// </summary>
        private readonly DAL.Common dal = new DAL.Common();

        /// <summary>
        /// 分页获取数据
        /// <creator>wangl</creator>
        /// <date>2013-09-06</date>
        /// </summary>       
        /// <param name="tableName">表名</param>
        /// <param name="fields">字段名(全部字段为*)</param>
        /// <param name="pageSize">每页显示多少条记录</param>
        /// <param name="pageIndex">指定当前为第几页 </param>
        /// <param name="strWhere">条件语句(不用加where) </param>
        /// <param name="fOrderFiled">排序字段(必须!支持多字段)  </param>
        /// <param name="orderType">排序方式，非0则降序</param>
        /// <param name="total">返回总记录数</param>
        /// <returns>返回所取ds</returns>
        public DataSet GetListByPage(string tableName, string fields, int pageSize, int pageIndex, string strWhere, string fOrderFiled, int orderType, out int total)
        {
            return dal.GetListByPage(tableName, fields, pageSize, pageIndex, strWhere, fOrderFiled, orderType, out total);
        }
        /// <summary>
        /// 获取数据库时间
        /// 如果数据库无法获取则取当前的本地时间
        /// <creator>wangl</creator>
        /// <date>2013-11-05</date>
        /// </summary>
        /// <returns></returns>
        public DateTime GetServerDateTime()
        {
            return dal.GetServerDateTime();
        }
    }
}
